package com.innovation.chengzhangriji.ui.widget;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.RelativeLayout;

import com.innovation.chengzhangriji.R;

public class DrawerMenuViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    public interface OnClickDrawerMenuListener {

        void onClickDrawerMenu(DrawerMenuViewHolder holder);

    }

    private CuteTextView mTextTitle;

    private CuteTextView mTextNumber;

    private OnClickDrawerMenuListener mOnClickDrawerMenuListener;

    public DrawerMenuViewHolder(View itemView) {
        super(itemView);
        RelativeLayout layout = (RelativeLayout) itemView.findViewById(R.id.layout);
        mTextTitle = (CuteTextView) itemView.findViewById(R.id.text_title);
        mTextNumber = (CuteTextView) itemView.findViewById(R.id.text_number);
        layout.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (mOnClickDrawerMenuListener == null) {
            return;
        }
        if (v.getId() == R.id.layout) {
            mOnClickDrawerMenuListener.onClickDrawerMenu(this);
        }
    }

    public void setTitle(String title) {
        mTextTitle.setText(title);
    }

    public void setNumber(String number) {
        mTextNumber.setText(number);
    }

    public void setOnClickDrawerMenuListener(OnClickDrawerMenuListener onClickDrawerMenuListener) {
        mOnClickDrawerMenuListener = onClickDrawerMenuListener;
    }
}
